Dynamic Objects are objects that can be affected by the laws of physics in a PhSim simulation.
Dynamic Objects are created using the PhSim.DynObject constructor.
Dynamic Objects are associated with a Matter.js body. The matter.js body is found in PhSim.DynObject.prototype.matter
.
Moving Dynamic Objects
Dynamic objects can undergo motion in several ways. First, they are affected by gravity. Second, there are functions in the PhSim.Motion namespace that can make objects move:
- PhSim.Motion.applyForce - Applies a force to an object.
- PhSim.Motion.rotate - Rotates an object
- PhSim.Motion.setAngle - Set angle
- PhSim.Motion.setPosition - Set position
- PhSim.Motion.setVelocity - Set the velocity of a dynamic object.
- PhSim.Motion.translate - Translate a dynamic Object
Dynamic Objects can be moved using widgets as well.